.extern   Kernel_Main
.global   Kernel_Start
.equ      EnterKernelStack,0x10000
Kernel_Start:
     jmp Artist_Kernel
.align 8
  GDTBegin:                   .quad  0x0000000000000000
  GDTKernelCode:              .quad  0x00CF9A000000FFFF
  GDTKernelData:              .quad  0x00CF92000000FFFF
  GDTCGA:                     .quad  0x00C0920B80000002
  GDTEnd:                     .quad  0x0000000000000000
  .equ  GDTLength,GDTEnd-GDTBegin
  GDTPointer:                 .word  GDTLength-1
                              .int   GDTBegin
  .equ   SelectorKernelCode,GDTKernelCode-GDTBegin
  .equ   SelectorKernelData,GDTKernelData-GDTBegin
  .equ   SelectorCGA       ,GDTCGA       -GDTBegin
.section  .text
Artist_Kernel:
    lgdt  GDTPointer
    cli
    inb   $0x92,%al
    orb   $0b00000010,%al
    outb  %al,$0x92
    movl  %cr0,%eax
    orl   $1,%eax
    movl  %eax,%cr0
    ljmpl $SelectorKernelCode,$LABEL_TEMP
LABEL_TEMP:
   movw  $SelectorKernelData,%ax
   movw  %ax,%ds
   movw  %ax,%es
   movw  %ax,%fs
   movw  %ax,%ss
   movw  $SelectorCGA,%ax
   movw  %ax,%gs
   

    movl  $EnterKernelStack,%esp
    call  Artist
    #The following sentence is just for protecting the machine.
    jmp   .


